<?php $this->load->view('public/member_pubnav');?>
<div id="message2">
    <div>
        <!-- Content -->
        <section id="wrapper">
            <div id="container">
            <!-- 
                <div id="say">
                    <div class="say1"><img src="<?php echo base_url();?>images/publick/say.gif"></div>
                    <div class="clr1"></div>
                    <textarea onfocus="this.value=''">说两句心得！
                        晒晒我最近淘的新宝贝。
                    </textarea>
                    <div class="clr1"></div>
                    <div class="say1"></div>
                    <div class="clr1"></div>
                    <div id="publish"><img src="<?php echo base_url();?>images/publick/button.gif"></div>
                </div>
 			-->
                <?php
                	$this->member_id = $this->session->userdata('member_id');
                	$like_baby_count = '';
                    if(!empty($like_baby)){
                    	
                        foreach($like_baby as $lbk => $lbv){
                            $one_baby = $this->baby->get_one_list($lbv['baby_id']);  //单件宝贝信息
                            
                            $one_member = $this->member->get_one_list($lbv['liker_id']);  //单个人员信息

                            $like_baby_count = count($this->like_baby->get_list(array('baby_id'=>$lbv['baby_id'])));
                ?>
                <div class="nobox block description">
                    <div class="u_mess">
                        <div class="u_mess1">
                            <a href="<?php echo base_url('column/center').'/'.$one_member['id'];?>"><img style="width:60px;height:60px;" src="<?php if(!empty($one_member['img'])){echo base_url().'upload/avator/'.$one_member['img'];}else{echo 'http://assets.taobaocdn.com/app/sns/img/default/avatar-40.png';}?>"/></a>
                        </div>
                        <div class="u_mess2">
                            <p class="font11"><a href="<?php echo base_url('column/center').'/'.$one_member['id'];?>"> <font color="#990000"><b><?php if(!empty($one_member['name'])) echo $one_member['name'];?>: </b></font></a>
                                <?php if(!empty($one_baby['desc'])) echo $one_baby['desc'];?></p>
                            <span>
                            <?php 
	                            //计算修改专辑时间
	                            if($lbv['addtime']){
	                            	$second = (time()-strtotime($lbv['addtime']));  //秒
	                            	$minute = floor($second/60);  //分，取整
	                            	$hour = floor($minute/60);  //小时，取整
	                            	$day = floor($hour/24);  //天，取整
	                            	if($second < 60) $edit_time = $second."秒前";
	                            	elseif ($minute < 60 && $second > 60) $edit_time = $minute."分钟前";
	                            	elseif ($hour < 24 && $minute > 60) $edit_time = $hour."小时前";
	                            	else $edit_time = $day."天前";
	                            }else{
	                            	$edit_time = "刚刚";
	                            }
	                            echo $edit_time."喜欢了";
                            ?>
                            </span>
                        </div>
                    </div>
                    <a href="<?php echo base_url().'index/baby_detail'.'/'.$lbv['baby_id'];?>" target="_blank"><img src="<?php echo base_url().'upload/baby/'.$one_baby['big_img'];?>"></a>
                    <div class="xiaoxi">
                        <div class="xiaoxi1 <?php if(!empty($this->member_id)){echo 'like_baby';} else {echo 'notin';}?>" baby_id="<?php echo $lbv['baby_id'];?>"><img src="<?php echo base_url();?>images/column/like1.jpg"></div>
                        <font class="show_like_success"></font>
                        <font class="show_like_num"><?php echo $like_baby_count;?></font>人喜欢
                    </div>
                </div>
                <?php }}?>

                <?php 
                	foreach($focus as $fk => $fv){
	                	$my_one_m = $this->member->get_one_list($fv['focuser']);   //获取个人资料            	

	                	$search_one_like_baby = $this->like_baby->get_list(array('liker_id'=>$fv['focuser']),'','','addtime desc');  //查看动态
	                	$count_lb = count($search_one_like_baby);
	                	
	                	if($count_lb > 0){  //如果这人有收藏宝贝
	                		foreach($search_one_like_baby as $searchlb){
	                			//$s_o_baby_sql = 'select * from baby where id = '. $searchlb['baby_id'];
	                			$s_o_baby = $this->baby->get_one_list($searchlb['baby_id']);  //查看这个宝贝的信息
	                			if($s_o_baby){  
                ?>
                <div class="nobox block description">
                    <div class="u_mess">
                        <div class="u_mess1">
                            <a href="<?php echo base_url('column/center').'/'.$my_one_m['id'];?>"><img style="width:60px;height:60px;" src="<?php if(!empty($my_one_m['img'])){echo base_url().'upload/avator/'.$my_one_m['img'];}else{echo 'http://assets.taobaocdn.com/app/sns/img/default/avatar-40.png';}?>" /></a>
                        </div>
                        <div class="u_mess2">
                            <p class="font11"> <a href="<?php echo base_url('column/center').'/'.$my_one_m['id'];?>"><font color="#990000"><b><?php if(!empty($my_one_m['name'])) echo $my_one_m['name'];?>: </b></font></a>
                                <?php if(!empty($s_o_baby['desc'])) echo $s_o_baby['desc'];?></p>
                            <span>
                            <?php 
	                            //计算修改专辑时间
	                            if($searchlb['addtime']){
	                            	$second = (time()-strtotime($searchlb['addtime']));  //秒
	                            	$minute = floor($second/60);  //分，取整
	                            	$hour = floor($minute/60);  //小时，取整
	                            	$day = floor($hour/24);  //天，取整
	                            	if($second < 60) $edit_time = $second."秒前";
	                            	elseif ($minute < 60 && $second > 60) $edit_time = $minute."分钟前";
	                            	elseif ($hour < 24 && $minute > 60) $edit_time = $hour."小时前";
	                            	else $edit_time = $day."天前";
	                            }else{
	                            	$edit_time = "刚刚";
	                            }
	                            echo $edit_time."喜欢了";
                            ?>
                            </span>
                        </div>
                    </div>
                    <a href="<?php echo base_url().'index/baby_detail'.'/'.$s_o_baby['id'];?>" target="_blank"><img src="<?php echo base_url().'upload/baby/'.$s_o_baby['big_img'];?>"></a>
                    <div class="xiaoxi">
                        <div class="xiaoxi1 <?php if(!empty($this->member_id)){echo 'like_baby';} else {echo 'notin';}?>" baby_id="<?php echo $s_o_baby['id'];?>"><img src="<?php echo base_url();?>images/column/like1.jpg"></div>
                        <font class="show_like_success"></font>
                        <font class="show_like_num"><?php echo $like_baby_count;?></font>人喜欢
                    </div>
                </div>
                <?php }}}}?>

        </section>

    </div>
</div>
</div>
<?php $this->load->view('public/member_pubfooter');?>
<script type="text/javascript">
    $(document).ready(function(){
        $('.like_baby').click(function(){
            $baby_id = $(this).attr('baby_id');
            thats = $(this);
            $.ajax({
                type:"POST",
                url:"<?php echo base_url().'column/like_baby'?>",
                dataType:"json",
                data:{"baby_id":$baby_id},
                success:function(data){
                    thats.parents('.xiaoxi').find('.show_like_success').html(data.error);
                    thats.siblings('.show_like_num').html(data.like_num);
                    //return ;
                }
            })
        });
        $('.notin').click(function(){
            alert('小主，登录之后可以喜欢这宝贝哟~');
            //return false;
        });
        
    })

</script>